<?php

/**
 * Answer form base class.
 *
 * @package    form
 * @subpackage answer
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseAnswerForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'             => new sfWidgetFormInputHidden(),
      'question_id'    => new sfWidgetFormDoctrineSelect(array('model' => 'Question', 'add_empty' => false)),
      'user_survey_id' => new sfWidgetFormDoctrineSelect(array('model' => 'UserSurvey', 'add_empty' => false)),
      'content'        => new sfWidgetFormTextarea(),
    ));

    $this->setValidators(array(
      'id'             => new sfValidatorDoctrineChoice(array('model' => 'Answer', 'column' => 'id', 'required' => false)),
      'question_id'    => new sfValidatorDoctrineChoice(array('model' => 'Question')),
      'user_survey_id' => new sfValidatorDoctrineChoice(array('model' => 'UserSurvey')),
      'content'        => new sfValidatorString(),
    ));

    $this->widgetSchema->setNameFormat('answer[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Answer';
  }

}